package com.quanyan.api.enums;

import com.quanyan.common.enums.BaseEnum;

/**
 * @author songzj
 * @date 16/4/14-15:30
 */
public enum ApiResponseEnum implements BaseEnum {

    SUCCESS(           200, "SUCCESS"           , "成功"         ,  true),
    FAIL(           100, "FAIL"           , "失败"         ,  false),
    PARAMETER_INVALID( 600, "PARAMETER_INVALID" , "非法参数"      , false),
    PARAMETER_CANT_BE_EMPTY( 601, "PARAMETER_CANT_BE_EMPTY" , "缺少必要参数"      , false),
    INTERNAL_ERROR(    500, "INTERNAL_ERROR"    , "服务器处理失败" , false),
    RESOURCE_NOT_FOUND(404, "RESOURCE_NOT_FOUND", "资源不存在"     , false),
    PERMISSION_DENIED( 601, "PERMISSION_DENIED" , "无权限操作"     , false),
    NEED_USER_LOGIN(   602, "NEED_USER_LOGIN"   , "需要用户登录"   , false),
    ILLEGAL_PROTOCOL(   603, "ILLEGAL_PROTOCOL"  , "非法请求"   , false),
    VALIDATE_CODE_ERROR(604, "VALIDATE_CODE_ERROR"  , "手机验证码错误"   , false),
    HAVE_TWO_ZERO_ORDER(605, "HAVE_TWO_ZERO_ORDER"  , "存在两个连续零元订单"   , false),
    WAIT_SMS_CODE_CONFIRM(606, "WAIT_SMS_CODE_CONFIRM"  , "等待验证手机验证码"   , false),
    SIGN_IS_NULL(607, "SIGN_IS_NULL"  , "签名为空"   , false),
    BODY_IS_NULL(608, "BODY_IS_NULL"  , "请求体为空"   , false),
    COOKIES_IS_NULL(609, "COOKIES_IS_NULL", "用户信息为空",false),
    USER_IS_NULL(610,"USER_IS_NULL","用户不存在",false),
    ACCOUNT_OR_PASSWORD_ERROR(611,"ACCOUNT_OR_PASSWORD_ERROR","账号或者密码错误",false),
    ACCONT_IS_ENABLED(612,"ACCONT_IS_ENABLED","账号已禁用，请联系百灵鸟客服。",false),
    /**
     * 是否存在
     */
    DO_NOT_HAVE_ANY_MORE_RECORD(40000, "DO_NOT_HAVE_ANY_MORE_RECORD"   , "没有更多记录"   , false),
    RECORD_DO_NOT_EXISTS(40001, "RECORD_DO_NOT_EXISTS"   , "记录不存在"   , false),


    /**
     * 有关联关系
     */
    HAVE_ENABLE_CHILDREN(50000, "HAVE_ENABLE_CHILDREN", "该记录拥有可用子记录", false),

    /**
     * 登陆注册异常
     */
    ACCOUNT_BINDING_USER_NULL(60000,"ACCOUNT_BINDING_USER_NULL","账号绑定用户不存在",false),
    ACCOUNT_NOT_BINDING(60001,"ACCOUNT_NOT_BINDING","账号暂未绑定",false),
    ACCOUNT_BINDING_FAIL(60002,"ACCOUNT_BINDING_FAIL","账号绑定失败",false),
    ACCOUNT_HAD_BINDING(60003,"ACCOUNT_HAD_BINDING","该第三方账号已绑定其账号",false);

    protected int id;

    protected String code;

    protected String label;

    protected boolean success;

    ApiResponseEnum(int id, String code, String label, boolean success) {
        this.id = id;
        this.code = code;
        this.label = label;
        this.success = success;
    }


    @Override
    public int getId() {
        return id;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public boolean isSuccess() {
        return success;
    }

}
